﻿package com.dbm.model;

import org.apache.log4j.Logger;

import com.dbm.dao.CtlPublicDao;
import com.dbm.dao.LsDao;
import com.dbm.util.JaxbUtil;
import com.dbm.util.LsInfo;
import com.dbm.util.Response;

public class SendLsPost {
private String param="";
private CtlHttp ctlHttp = new CtlHttp();
private CtlPublicDao ctlPublicDao = new CtlPublicDao();
private LsDao lsDao = new LsDao();
Logger log = Logger.getLogger("流水请求发送处理---com.gotop.model.ctl.publicmodel.SendLsPost");
/**
 * 发送流水请求
 */
public void sendLsPost(LsInfo lsInfo) throws Exception{
	param = "method=orderprocess.report&sign=NO&msg=" + lsInfo.getParam();
	String result = ctlHttp.getHttpResult(param);
	if (!"".equals(result)) {
		log.info("发运订单流水返回报文：" + result);// 向ctl发送流水请求
		lsInfo.setResult(result);
		JaxbUtil jaxbUtil = new JaxbUtil(Response.class);
		Response response = jaxbUtil.fromXml(result);
		lsDao.upLsSendFlag(lsInfo);
	} else {
		ctlPublicDao.addCtlErrorHttpPost(param);
		lsDao.upLsSendFlag(lsInfo);
		log.error("发运订单流水请求发送失败，httppost参数已经记录ctl层数据库的ERRORHTTPPOST表");
	}
}
}
